package com.tools.cleanmaster.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.MotionEvent;
import android.view.WindowManager;

import com.tools.cleanmaster.R;
import com.tools.cleanmaster.ui.base.SingleActivity;

/**
 * desc:
 * date: 2018/3/7
 * author: ancun
 */

public class DismissKeyguardActivity extends SingleActivity {

    @Override
    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
        sendEmptyMessage(R.id.msg_cleaner_smart_charging_dismiss_keyguard, 500L);
    }

    @Override
    public void subHandleMessage(Message msg) {
        if (msg.what == R.id.msg_cleaner_smart_charging_dismiss_keyguard) {
            if (!isFinishing()) {
                removeEmptyMessage(R.id.msg_cleaner_smart_charging_dismiss_keyguard);
                finish();
            }

        }
    }

    @Override
    protected void doOnResume() {
        super.doOnResume();
    }

    @Override
    protected void doOnPause() {
        super.doOnPause();
        sendEmptyMessage(R.id.msg_cleaner_smart_charging_dismiss_keyguard, 100L);
    }

    @Override
    protected void onNewIntent(Intent paramIntent) {
        super.onNewIntent(paramIntent);
    }

    @Override
    protected void onUserLeaveHint() {
        super.onUserLeaveHint();
        sendEmptyMessage(R.id.msg_cleaner_smart_charging_dismiss_keyguard, 100L);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent paramMotionEvent) {
        return false;
    }

}
